package login;

import java.util.Enumeration;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

public class ServletInit extends HttpServlet {
	private static final long serialVersionUID = -3300862540586116284L;

	// @Override
	public void init() throws ServletException {
		System.out.println("init the servlet");

		/* 获取ServletContext对象 */
		ServletContext context = this.getServletContext();

		/* 获取初始化参数 */

		 //获取web.xml文件中所有的初始化应用参数
		Enumeration<String> enumer = context.getInitParameterNames();

		while (enumer.hasMoreElements()) {
			String name = enumer.nextElement();
			String value = context.getInitParameter(name);
			System.out.println(name + "==========" + value);
		}
	}

}
